7.4 Adjustable Plots

Adjustable plots make use of variable definitions that have been added to the plotter. When the elaboration is changed, the expression bound to the definition changes as well.

A real variable definition is displayed as a one-dimensional plot: a point on the X-axis. The value of the elaboration is indicated by a magnitude indicator. Changing the indicator by sliding it changes the elaboration.

A point variable definition is displayed as a point indicator in two-dimensional space. Changing the point indicator by dragging it in any direction changes the elaboration of the variable definition.

When variables referenced by a plottable expression are displayed in the plotter, changes to magnitude and point indicators cause the function to be re-evaluated. Variables with indicators are called adjusters.

7.4.1 Adjusting magnitude

Figure 7.2 shows three magnitude adjusters, one of which is associated with a real definition m_3 .→m_1-m_2 dependent on two other real definitions associated with the other two magnitude adjusters. Moving either of the independent adjusters changes the position of the dependent adjuster. Moving the dependent adjuster changes its associated definition to have a constant elaboration, losing its dependencies.

Figure 7.2 Dependent and independent magnitude adjusters

7.4.2 Adjusting a position vector

Figure 7.3 shows two magnitude adjusters and a position vector dependent on them. As the indicators are moved, the end point of the vector is changed.

Figure 7.3 Position vector dependent on magnitude adjusters

7.4.3 Adjusting a point

Figure 7.4 shows a point indicator associated with a vector definition that is dependent on two real definitions, each in turn associated with magnitude indicators. Moving either of the magnitude indicators changes the position of the point indicator. Moving the point indicator itself changes the associated vector definition, losing its dependence on the real definitions.

Figure 7.4 Point dependent on magnitude adjusters

7.4.4 Adjusting line segments

Figure 7.5 shows a tuple dependent on three point indicators. Moving any of the point indicators adjusts the position of the line segments.

Figure 7.5 Line segments dependent on point adjusters

7.4.5 Adjusting a straight line

The function for a straight line is given by f(x)→m⋅x+b. In the presence of constant definitions m→1 and b→0, the plot appears as a straight line. With the variable definitions added to the plot display, the effect of changing the slope and intercept can be seen immediately. Figure 7.6 shows the effect.

Figure 7.6 Slope and intercept adjusters

7.4.6 Adjusting the number of roots

The expression x⋅(x-1)⋅(x-2) has a graph that crosses the x-axis at 3 points. To illustrate functions with varying number of roots, the expression can be rewritten using a product generator, f(x)→∏0, L, x-iⅆi, where L is bound to a constant. Varying L with an adjuster shows the different graphs. See Figure 7.7.

(a) 3 roots(b) 4 roots(b) 5 roots
Figure 7.7 Functions with varying number of roots

7.4.7 Adjusting a tangent

To plot a function and its tangent under the control of an adjuster,

  1. Add the function in the form y(x)→… to the display, say y(x)→x^3-x.
  2. Add the equation y(x)→ⅆy(x)ⅆx⋅x+b, isolate b, substitute both occurrences of y(x), take the derivative and simplify the equation.
  3. Add an equation of the form y_t(x_t)→ⅆy(x)ⅆx⋅x_t+b; substitute y(x) and b, take the derivative and simplify.
  4. Add a definition of the form x→1 to the display
  5. Select all and apply Plot. Refer to Figure 7.8.
(a) Tangent at x=-0.6 (b) Tangent at x=0.7
Figure 7.8 Lines tangent to a function

Try this for (1) y(x)→x^3-x. You should end up with these equations: (2) b.→-2⋅x^3, (3) y_t(x_t)→(3⋅x^2-1)⋅x_t-2⋅x^3 and (4) x→1. Select all the expressions and Display Plot . On the Plot display, touch the adjuster for the x constant and move it right or left. Observe the line tangent to y(x)→x^3-x changes its slope and position so it always touches the function at the point designated by x.

There are some issues of scope and binding that require explanation in order to fully understand what is happening. The x in (1) is bound to the parameter in y(x), which is in turn bound at plot-evaluation time to values on the x-axis. In contrast, the x in (3) is bound to the constant in (4), while x_t in (3) is bound to the parameter in y_t(x_t), which again is bound at plot-evaluation time to values on the x-axis. Finally, (2) represents the equation of the derivative of (1), evaluated at each point on the x-axis.

Try to plot the function and its tangent for y(x)→x^x.